package com.ruoyi.university.service.impl;

import java.util.List;

import com.ruoyi.university.domain.UniversityCampusVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.university.mapper.UniversityCampusMapper;
import com.ruoyi.university.domain.UniversityCampus;
import com.ruoyi.university.service.IUniversityCampusService;

/**
 * 校区Service业务层处理
 * 
 * @author atzx
 * @date 2024-04-14
 */
@Service
public class UniversityCampusServiceImpl implements IUniversityCampusService 
{
    @Autowired
    private UniversityCampusMapper universityCampusMapper;

    /**
     * 查询校区
     * 
     * @param campusId 校区主键
     * @return 校区
     */
    @Override
//    public UniversityCampus selectUniversityCampusByCampusId(Long campusId)
    public UniversityCampusVo selectUniversityCampusByCampusId(Long campusId)
    {

//        return universityCampusMapper.selectUniversityCampusByCampusId(campusId);
        //=========================================================
        return universityCampusMapper.selectUniversityCampusByCampusId(campusId);
    }

    /**
     * 查询校区列表
     * 
     * @param universityCampus 校区
     * @return 校区
     */
    @Override
    public List<UniversityCampus> selectUniversityCampusList(UniversityCampus universityCampus)
    {
        System.out.println("接收到的大学校区列表"+ universityCampus);
        List<UniversityCampus> universityCampuses = universityCampusMapper.selectUniversityCampusList(universityCampus);
        System.out.println("列表："+ universityCampuses);
        return universityCampuses;
    }

    /**
     * 新增校区
     * 
     * @param universityCampus 校区
     * @return 结果
     */
    @Override
    public int insertUniversityCampus(UniversityCampus universityCampus)
    {
//        return universityCampusMapper.insertUniversityCampus(universityCampus);
        //================================
        int i = universityCampusMapper.insertUniversityCampus(universityCampus);
        return i;
    }

    /**
     * 修改校区
     * 
     * @param universityCampus 校区
     * @return 结果
     */
    @Override
    public int updateUniversityCampus(UniversityCampus universityCampus)
    {
        return universityCampusMapper.updateUniversityCampus(universityCampus);
    }

    /**
     * 批量删除校区
     * 
     * @param campusIds 需要删除的校区主键
     * @return 结果
     */
    @Override
    public int deleteUniversityCampusByCampusIds(Long[] campusIds)
    {
        return universityCampusMapper.deleteUniversityCampusByCampusIds(campusIds);
    }

    /**
     * 删除校区信息
     * 
     * @param campusId 校区主键
     * @return 结果
     */
    @Override
    public int deleteUniversityCampusByCampusId(Long campusId)
    {
        return universityCampusMapper.deleteUniversityCampusByCampusId(campusId);
    }


    //===========================================================================

    @Override
    public List<UniversityCampusVo> selectUniversityCampusList(UniversityCampusVo universityCampusVo) {
        System.out.println("接收到的大学校区以及列表"+ universityCampusVo);
        List<UniversityCampusVo> universityCampuses = universityCampusMapper.selectUniversityAndCampusList(universityCampusVo);
        System.out.println("列表："+ universityCampuses);
        return universityCampuses;
    }



}
